#! /bin/sh
#### Run GBmod with Xwindow Graphics
#### Create Figure 8 in the GBmod paper

#
model=4

####  find the right directory
datadir=../datadir/

####  aux files
modelfile=${datadir}model${model}.data
rayendsfile=${datadir}rayend.data
rayfile=${datadir}ray.data
fresnelfile=${datadir}fresnel.data

nangle=2 nxz=201 fangle=12 langle=22
ffreq=30

####   create the model
# ../Models/Xmodel${model}

####   shoot the rays 
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile fresnelfile=$fresnelfile \
        nxz=$nxz xs=5 zs=1.2 ffreq=$ffreq krecord=2 \
        fangle=$fangle langle=$langle nangle=$nangle\
	refseq=2,-1  refseq=8,1 refseq=9,1 refseq=10,1 

nangle=`cat outpar`

####   plot the rays 
xgraph linecolor=3 <$rayfile -geom 600x300+670+330 nplot=$nangle n=$nxz \
        x1beg=0 x1end=10 x2beg=0 x2end=20  style=seismic linecolor=3 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths" &

####   plot the  Fresnel-volumes
xgraph linecolor=3 <$fresnelfile -geom 600x300+670+660 style=seismic linecolor=3 \
        nplot=`expr $nxz \* $nangle` n=2  label2="Distance (km)" \
        x1beg=0 x1end=10 x2beg=0 x2end=20  label1="Depth (km)" \
        title=" Fresnel volumes ($ffreq Hz)"&

#### Create X-Windows display of model
sxplot <$modelfile -geom 600x300+670+0 tricolor=none \
        label1="Depth (km)" label2="Distance (km)" &


exit 0
